<template>
    <div>
        <h3>Son</h3>
        <p>子组件的num:{{num}}</p>
    </div>
</template>

<script>
import {eventBus} from "@/ eventBus";
export default {
    name: "Son",
    data() {
        return {
            num: 0
        }
    },
    mounted() {
        eventBus.$on("addNum",num=>{
            this.num+=num
        })
    }
}
</script>

<style scoped>

</style>